
-- Global
function GetMinimapShape() return "SQUARE" end;

-- Addon
local tMinimapFrame = CreateFrame("Frame");
local framesToHide = {
	MinimapBorder,
	MinimapZoomIn,
	MinimapZoomOut,
	MinimapZoneText,
	MinimapBorderTop,
	MinimapToggleButton,
	MinimapZoneTextButton,
	MiniMapWorldMapButton,
	MiniMapMeetingStoneFrame,
	MiniMapVoiceChatFrame,
	BattlegroundShine,
	GameTimeFrame,
};

local tMinimap = function(self)
	if event == "PLAYER_LOGIN" then
		self:SetParent(Minimap);
		self:SetFrameLevel(1);
		self:SetBackdrop({
			bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
			insets = {left = -1.5, right = -2, top = -1.5, bottom = -2},
		});
		self:SetBackdropColor(0, 0, 0);
		self:SetAllPoints(Minimap);
		
		MiniMapTrackingBorder:Hide();
		MiniMapTrackingBackground:Hide();
		MiniMapTracking:SetParent(Minimap);
		MiniMapTracking:ClearAllPoints();
		MiniMapTracking:SetPoint("TOPLEFT", -2, 2);
		
		MiniMapBattlefieldBorder:Hide();
		MiniMapBattlefieldFrame:SetParent(Minimap);
		MiniMapBattlefieldFrame:ClearAllPoints();
		MiniMapBattlefieldFrame:SetPoint("TOPRIGHT", -2, -2);
		
		MiniMapMailBorder:Hide();
		MiniMapMailFrame:SetParent(Minimap);
		MiniMapMailFrame:ClearAllPoints();
		MiniMapMailFrame:SetPoint("TOP");
		MiniMapMailFrame:SetHeight(8);
		MiniMapMailIcon:Hide();
		
		Minimap:SetMaskTexture("Interface\\AddOns\\tMinimap\\mask");
		
		Minimap:ClearAllPoints();
		Minimap:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", -15, -15);
		Minimap:SetScale(0.9);
		
		local t = Minimap:CreateTexture(nil, "OVERLAY");
		t:SetTexture("Interface\\AddOns\\tMinimap\\texture");
		t:SetPoint("TOPLEFT", Minimap, "TOPLEFT", -0, 0);
		t:SetPoint("BOTTOMRIGHT", Minimap, "BOTTOMRIGHT", 0, -0);
		
		for _,f in pairs(framesToHide) do
			f:Hide()
			f.Show = function() end
		end
	end
end

tMinimapFrame:SetScript("OnEvent", tMinimap);
tMinimapFrame:RegisterEvent("PLAYER_LOGIN");
tMinimapFrame:RegisterEvent("UPDATE_PENDING_MAIL");